﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Model;
using BLL;
using System.Web.Services;
using Newtonsoft.Json;

namespace PropertyAppraisal.DoemsKanCha
{
    public partial class DomeXiaoqu : System.Web.UI.Page
    {
        private static BLL.VillageBll bll = new  VillageBll  ();
        protected void Page_Load(object sender, EventArgs e)
        {

        }
        /// <summary>
        /// 反填详细信息
        /// </summary>
        /// <param name="pnum"></param>
        /// <returns></returns>
        [WebMethod]
        public static string BackData(string pnum)
        {
            var result = bll.GetListByPro(pnum);
            return JsonConvert.SerializeObject(result);
        }
        /// <summary>
        /// 添加
        /// </summary>
        /// <returns></returns>
        [WebMethod]
        public static int submins(string ProjectNumber, string Village_CaseName, string Village_Cause, int Village_Close,
            int Village_Structure, int Village_Traffic, int Village_Green, int Village_Volume, int Village_Parking,
            int Village_Property, string Village_Explain)
        {
            Model.EAVillage l = new Model.EAVillage();
            l.projectNumber = ProjectNumber;
            l.village_CaseName = Village_CaseName;
            l.village_Cause = Village_Cause;
            l.village_Close = Village_Close;
            l.village_Structure = Village_Structure;
            l.village_Traffic = Village_Traffic;
            l.village_Green = Village_Green;
            l.village_Volume = Village_Volume;
            l.village_Parking = Village_Parking;
            l.village_Property = Village_Property;
            l.village_Explain = Village_Explain;
            l.village_CreateTime = DateTime.Now;
            l.village_CreatePeople = "小黑";

            BLL.VillageBll bll = new BLL.VillageBll();
            if (bll.GetCount(ProjectNumber) == 0)
            {

                if (bll.Add(l))
                {
                    return 1;
                }
                else
                    return 0;
            }
            else
            {
                if (bll.Update(l))
                {
                    return 1;
                }
                else
                {
                    return 0;
                }

            }

        }

        /// <summary>
        /// 绑定小区封闭性
        /// </summary>
        /// <returns></returns>
        public static string FengBi()
        {
            DictionaryBll Dictionarybll = new DictionaryBll();
            List<SysDictionary> Dictionary = Dictionarybll.sb(11);
            var HtmlStr = "";
            for (var i = 0; i < Dictionary.Count; i++)
            {
                HtmlStr += "<option value=\"" + Dictionary[i].Dictionary_Number + "\">" + Dictionary[i].dictionary_Name + "</option>";
            }
            return HtmlStr;
        }

        /// <summary>
        /// 绑定居住小区楼宇结构
        /// </summary>
        /// <returns></returns>
        public static string HouseStruct()
        {
            DictionaryBll Dictionarybll = new DictionaryBll();
            List<SysDictionary> Dictionary = Dictionarybll.sb(12);
            var HtmlStr = "";
            for (var i = 0; i < Dictionary.Count; i++)
            {
                HtmlStr += "<option value=\"" + Dictionary[i].Dictionary_Number + "\">" + Dictionary[i].dictionary_Name + "</option>";
            }
            return HtmlStr;
        }

        /// <summary>
        /// 绑定交通组织方式
        /// </summary>
        /// <returns></returns>
        public static string JiaoTong()
        {
            DictionaryBll Dictionarybll = new DictionaryBll();
            List<SysDictionary> Dictionary = Dictionarybll.sb(13);
            var HtmlStr = "";
            for (var i = 0; i < Dictionary.Count; i++)
            {
                HtmlStr += "<option value=\"" + Dictionary[i].Dictionary_Number + "\">" + Dictionary[i].dictionary_Name + "</option>";
            }
            return HtmlStr;
        }

        /// <summary>
        /// 绑定景观及绿化
        /// </summary>
        /// <returns></returns>
        public static string JingGuan()
        {
            DictionaryBll Dictionarybll = new DictionaryBll();
            List<SysDictionary> Dictionary = Dictionarybll.sb(14);
            var HtmlStr = "";
            for (var i = 0; i < Dictionary.Count; i++)
            {
                HtmlStr += "<option value=\"" + Dictionary[i].Dictionary_Number + "\">" + Dictionary[i].dictionary_Name + "</option>";
            }
            return HtmlStr;
        }

        /// <summary>
        /// 绑定容积率
        /// </summary>
        /// <returns></returns>
        public static string RongJi()
        {
            DictionaryBll Dictionarybll = new DictionaryBll();
            List<SysDictionary> Dictionary = Dictionarybll.sb(15);
            var HtmlStr = "";
            for (var i = 0; i < Dictionary.Count; i++)
            {
                HtmlStr += "<option value=\"" + Dictionary[i].Dictionary_Number + "\">" + Dictionary[i].dictionary_Name + "</option>";
            }
            return HtmlStr;
        }

        /// <summary>
        /// 绑定车位状况
        /// </summary>
        /// <returns></returns>
        public static string CheWei()
        {
            DictionaryBll Dictionarybll = new DictionaryBll();
            List<SysDictionary> Dictionary = Dictionarybll.sb(16);
            var HtmlStr = "";
            for (var i = 0; i < Dictionary.Count; i++)
            {
                HtmlStr += "<option value=\"" + Dictionary[i].Dictionary_Number + "\">" + Dictionary[i].dictionary_Name + "</option>";
            }
            return HtmlStr;
        }

        /// <summary>
        /// 绑定物业公司
        /// </summary>
        /// <returns></returns>
        public static string WuYe()
        {
            DictionaryBll Dictionarybll = new DictionaryBll();
            List<SysDictionary> Dictionary = Dictionarybll.sb(17);
            var HtmlStr = "";
            for (var i = 0; i < Dictionary.Count; i++)
            {
                HtmlStr += "<option value=\"" + Dictionary[i].Dictionary_Number + "\">" + Dictionary[i].dictionary_Name + "</option>";
            }
            return HtmlStr;
        }
    }
}